<template>
  <el-row>
    <el-col :span="24">
      test
    </el-col>
  </el-row>
</template>
<script>

export default {
  data() {
    return {
      treeData: {
        lists: [
          {
            id: 40,
            parent_id: 0,
            order: 0,
            name: '动物类',
            uri: '/masd/ds',
            open: true,
            lists: []
          }, {
            id: 5,
            parent_id: 0,
            order: 1,
            name: '昆虫类',
            uri: '/masd/ds',
            open: true,
            lists: [
              {
                id: 12,
                parent_id: 5,
                open: true,
                order: 0,
                name: '蚂蚁',
                uri: '/masd/ds',
                lists: []
              }
            ]
          },
          {
            id: 19,
            parent_id: 0,
            order: 2,
            name: '植物类',
            uri: '/masd/ds',
            open: true,
            lists: []
          }
        ],
        columns: [
          {
            type: 'selection',
            title: '菜单名称',
            field: 'name',
            width: 200,
            align: 'center',
            formatter: (item) => {
              return '<a>' + item.name + '</a>'
            }
          },
          {
            title: '链接',
            field: 'url',
            width: 200,
            align: 'center'
          },
          {
            title: '操作',
            type: 'action',
            width: 350,
            align: 'center',
            actions: [
              {
                text: '查看角色',
                onclick: this.onDetail,
                formatter: (item) => {
                  return '<i>查看角色</i>'
                }
              },
              {
                text: '编辑',
                onclick: this.onEdit,
                formatter: (item) => {
                  return '<i>编辑</i>'
                }
              }
            ]
          }
        ]
      }
    }
  },
  methods: {
    onTreeDataChange(lists) {
      this.$set(this.treeData, 'lists', lists)
    },
    onEdit(item) {
      console.log(item, 'onEdit')
    },
    onDetail(item) {
      console.log(item, 'onDetail')
    }
  }
}
</script>
